<html>
<head>
	<?php $this->load->view('config/head');?>
	<script type="text/javascript">
		var group_id = <?php echo @$detail[0]['group_menu']?>
	
		$(document).ready(function(){
			if(group_id){
				if(group_id == 1){
					$("#advanceSet").show();
				}else{
					$("#advanceSet").hide();
				}
			}else{
				$("#advanceSet").hide();
			}
		});
		
		function getNilai(v){
			if(v == 1 || group_id == 1){
				$("#advanceSet").show();
			}else{
				$("#advanceSet").hide();
			}
		}
    </script>
</head>
<body>
	<?php $this->load->view('config/awal_body');?>
	
	<h3><?php echo $mode?> set menu</h3>
	<a href="<?php echo site_url()?>set_menu/index" class="btn">List set menu</a>
	<br/>
	<br/>
	<form method="post" action="<?php echo site_url() ?>set_menu/<?php echo $action?>" class="form-horizontal">
		<input type="hidden" name="id_menu" value="<?php echo @$detail[0]['id_menu']?>" />
		<div class="control-group">
			<label class="control-label" for="nama_menu">Nama Menu</label>
			<div class="controls">
				<input type="text" name="nama_menu" value="<?php echo @$detail[0]['nama_menu']?>" class="span5" />
			</div>
		</div>
		<div class="control-group">
			<label class="control-label" for="urut_menu">Urut Menu</label>
			<div class="controls">
				<input type="text" name="urut_menu" value="<?php echo @$detail[0]['urut_menu']?>" class="span2" />
			</div>
		</div>
		<div class="control-group">
			<label class="control-label" for="enable_menu">Enable</label>
			<div class="controls">
				<?php 
					if(@$detail[0]['enable_menu'] == 1){
						$check = "checked";
					}else{
						$check = "";
					}
				?>
				<input type="checkbox" name="enable_menu" value="1" <?php echo $check;?> />
			</div>
		</div>
		
		<div class="control-group">
			<label class="control-label" for="master_menu">Master menu</label>
			<div class="controls">
				<?php 
					if(@$detail[0]['master_menu'] == 1){
						$check = "checked";
					}else{
						$check = "";
					}
				?>
				<input type="checkbox" name="master_menu" value="1" <?php echo $check;?> />
			</div>
		</div>
		
		<div class="control-group">
			<label class="control-label" for="jenis_menu">Jenis menu</label>
			<div class="controls">
			
				<select name="jenis_menu">
					<?php if (@$detail[0]['jenis_menu'] == 1):?>
						<?php $selected1 =  'selected="selected"' ?>
					<?php elseif (@$detail[0]['jenis_menu'] == 2) :?>
						<?php $selected2 =  'selected="selected"' ?>
					<?php elseif (@$detail[0]['jenis_menu'] == 3) :?>
						<?php $selected3 =  'selected="selected"' ?>
					<?php else:?>
						<?php $selected1 =  '' ?>
						<?php $selected2 =  '' ?>
						<?php $selected3 =  '' ?>
					<?php endif;?>
					
					<option value="1" <?php echo $selected1 ?> >Master</option>
					<option value="2" <?php echo $selected2 ?> >Galery</option>
					<option value="3" <?php echo $selected3 ?> >Saran</option>
				</select>
			</div>
		</div>
		
		<div class="control-group">
			<label class="control-label" for="group_menu">Group menu</label>
			<div class="controls">
			
				<select name="group_menu" onChange="getNilai(this.value)">
					<?php if (@$detail[0]['group_menu'] == 1):?>
						<?php $selected =  'selected="selected"' ?>
					<?php else :?>
						<?php $selected =  '' ?>
					<?php endif;?>
				
					<option value="0">Tidak</option>
					<option value="1" <?php echo $selected ?> >Ya</option>
				</select>
			</div>
		</div>
		
		<div id="advanceSet">
			<div class="control-group">
				<label class="control-label" for="induk_menu">Induk menu</label>
				<div class="controls">
					<select name="induk_menu">
						<option value="0">Pilih induk</option>
						<?php if (@$induk):?>
							<?php foreach ($induk as $row):?>
								<?php if($row['id_menu'] == @$detail[0]['induk_menu']):?>
									<?php $selected =  'selected="selected"' ?>
								<?php else:?>
									<?php $selected =  '' ?>
								<?php endif;?>
								<option value="<?php echo $row['id_menu'] ?>" <?php echo $selected ?> ><?php echo $row['nama_menu'] ?></option>
							<?php endforeach?>
						<?php endif?>
					</select>
				</div>
			</div>
		</div>
		
		<div class="control-group">
			<label class="control-label" for="button">&nbsp;</label>
			<div class="controls">
				<input type="submit" name="submit" value="Save" class="btn btn-primary" />
				<input type="reset" value="Reset" class="btn" />
			</div>
		</div>
	</form>
	
	<?php $this->load->view('config/akhir_body');?>
</body>
</html>

